package br.com.fafica.fast_restaurant.view;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import java.awt.Font;
import java.awt.Color;
import javax.swing.SwingConstants;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.util.ArrayList;

import javax.swing.LayoutStyle.ComponentPlacement;

import br.com.fafica.fast_restaurant.control.ControlCliente;
import br.com.fafica.fast_restaurant.control.ControlFuncionario;

public class TelaCadastroFuncionario extends JFrame {

	private JPanel contentPane;
	private JTextField textFieldNome;
	private JTextField textFieldEnd;
	private JTextField textFieldBairro;
	private JTextField textFieldCpf;
	private JTextField textFieldFone;
	private JTextField textFieldEstado;
	private JTextField textFieldCidade;
	private JTextField textFieldCep;
	private JTextField textFieldLoguin;
	private JTextField textFieldSenha;

			public void run() {
				try {
					TelaCadastroFuncionario frame = new TelaCadastroFuncionario();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}

	public TelaCadastroFuncionario() {
		setTitle("CADASTRO FUNCIONARIO");
		final TelaCadastroFuncionario estaTela = this;
		
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 751, 406);
		contentPane = new JPanel();
		contentPane.setBackground(new Color(0, 100, 0));
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		
		JLabel label_1 = new JLabel();
		label_1.setText("NOME:");
		label_1.setForeground(new Color(255, 215, 0));
		label_1.setFont(new Font("Tahoma", Font.BOLD, 12));
		label_1.setBackground(Color.GRAY);
		
		JLabel label_2 = new JLabel();
		label_2.setText("ENDERE\u00C7O:");
		label_2.setForeground(new Color(255, 215, 0));
		label_2.setFont(new Font("Tahoma", Font.BOLD, 12));
		label_2.setBackground(Color.GRAY);
		
		textFieldNome = new JTextField();
		
		textFieldNome.setColumns(10);
		
		textFieldEnd = new JTextField();
		textFieldEnd.setColumns(10);
		
		JLabel label_3 = new JLabel();
		label_3.setText("BAIRRO:");
		label_3.setForeground(new Color(255, 215, 0));
		label_3.setFont(new Font("Tahoma", Font.BOLD, 12));
		label_3.setBackground(Color.GRAY);
		
		textFieldBairro = new JTextField();
		textFieldBairro.setColumns(10);
		
		JLabel label_4 = new JLabel();
		label_4.setText("ESTADO:");
		label_4.setForeground(new Color(255, 215, 0));
		label_4.setFont(new Font("Tahoma", Font.BOLD, 12));
		label_4.setBackground(Color.GRAY);
		
		JLabel label_5 = new JLabel();
		label_5.setText("FONE:");
		label_5.setForeground(new Color(255, 215, 0));
		label_5.setFont(new Font("Tahoma", Font.BOLD, 12));
		label_5.setBackground(Color.GRAY);
		
		JLabel label_6 = new JLabel();
		label_6.setText("CPF:");
		label_6.setForeground(new Color(255, 215, 0));
		label_6.setFont(new Font("Tahoma", Font.BOLD, 12));
		label_6.setBackground(Color.GRAY);
		
		textFieldCpf = new JTextField();
		textFieldCpf.setColumns(10);
		
		textFieldFone = new JTextField();
		textFieldFone.setColumns(10);
		
		textFieldEstado = new JTextField();
		textFieldEstado.setColumns(10);
		
		JLabel label_9 = new JLabel();
		label_9.setText("CEP:");
		label_9.setForeground(new Color(255, 215, 0));
		label_9.setFont(new Font("Tahoma", Font.BOLD, 12));
		label_9.setBackground(Color.GRAY);
		
		JLabel label_10 = new JLabel();
		label_10.setText("CIDADE:");
		label_10.setForeground(new Color(255, 215, 0));
		label_10.setFont(new Font("Tahoma", Font.BOLD, 12));
		label_10.setBackground(Color.GRAY);
		
		textFieldCidade = new JTextField();
		textFieldCidade.setColumns(10);
		
		textFieldCep = new JTextField();
		textFieldCep.setColumns(10);
		
		JButton button = new JButton("SALVAR");
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				ArrayList<String> Registro = new ArrayList<String>();
				Registro.add(textFieldNome.getText());
				Registro.add(textFieldEnd.getText());
				Registro.add(textFieldBairro.getText());
				Registro.add(textFieldCidade.getText());
				Registro.add(textFieldEstado.getText());
				Registro.add(textFieldCep.getText());
				Registro.add(textFieldCpf.getText());
				Registro.add(textFieldFone.getText());
				Registro.add(textFieldLoguin.getText());
				Registro.add(textFieldSenha.getText());

				ControlFuncionario ControllerFuncionario = new ControlFuncionario();
				ControllerFuncionario.Salvar(Registro);
			}
		});
		
		JButton button_1 = new JButton("SAIR");
		button_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
			

				estaTela.setVisible(false);
				TelaCadastro telaCadastro = new TelaCadastro();
				telaCadastro.setVisible(true);

			}
		});
				
		
		button_1.setOpaque(false);
		
		JLabel lblCadastroFuncionrio = new JLabel("CADASTRO FUNCIONARIO");
		lblCadastroFuncionrio.setVerticalAlignment(SwingConstants.BOTTOM);
		lblCadastroFuncionrio.setForeground(new Color(255, 215, 0));
		lblCadastroFuncionrio.setFont(new Font("Arial Black", Font.PLAIN, 20));
		
		textFieldLoguin = new JTextField();
		textFieldLoguin.setColumns(10);
		
		JLabel lblLoguin = new JLabel();
		lblLoguin.setText("LOGUIN:");
		lblLoguin.setForeground(new Color(255, 215, 0));
		lblLoguin.setFont(new Font("Tahoma", Font.BOLD, 12));
		lblLoguin.setBackground(Color.GRAY);
		
		JLabel lblSenha = new JLabel();
		lblSenha.setText("SENHA:");
		lblSenha.setForeground(new Color(255, 215, 0));
		lblSenha.setFont(new Font("Tahoma", Font.BOLD, 12));
		lblSenha.setBackground(Color.GRAY);
		
		textFieldSenha = new JTextField();
		textFieldSenha.setColumns(10);
		GroupLayout gl_contentPane = new GroupLayout(contentPane);
		gl_contentPane.setHorizontalGroup(
			gl_contentPane.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_contentPane.createSequentialGroup()
					.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_contentPane.createSequentialGroup()
							.addGap(36)
							.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
								.addGroup(gl_contentPane.createSequentialGroup()
									.addComponent(label_2, GroupLayout.PREFERRED_SIZE, 71, GroupLayout.PREFERRED_SIZE)
									.addGap(3)
									.addComponent(textFieldEnd, GroupLayout.PREFERRED_SIZE, 596, GroupLayout.PREFERRED_SIZE))
								.addGroup(gl_contentPane.createSequentialGroup()
									.addComponent(label_1, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE)
									.addGap(29)
									.addComponent(textFieldNome, GroupLayout.PREFERRED_SIZE, 596, GroupLayout.PREFERRED_SIZE))
								.addGroup(gl_contentPane.createSequentialGroup()
									.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false)
										.addGroup(gl_contentPane.createSequentialGroup()
											.addComponent(label_3, GroupLayout.PREFERRED_SIZE, 71, GroupLayout.PREFERRED_SIZE)
											.addGap(3)
											.addComponent(textFieldBairro, GroupLayout.PREFERRED_SIZE, 161, GroupLayout.PREFERRED_SIZE)
											.addGap(26)
											.addComponent(label_10, GroupLayout.PREFERRED_SIZE, 52, GroupLayout.PREFERRED_SIZE))
										.addGroup(gl_contentPane.createSequentialGroup()
											.addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
												.addComponent(textFieldCpf, GroupLayout.PREFERRED_SIZE, 161, GroupLayout.PREFERRED_SIZE)
												.addGroup(gl_contentPane.createSequentialGroup()
													.addComponent(label_4, GroupLayout.PREFERRED_SIZE, 59, GroupLayout.PREFERRED_SIZE)
													.addGap(15)
													.addComponent(textFieldEstado, GroupLayout.PREFERRED_SIZE, 161, GroupLayout.PREFERRED_SIZE)))
											.addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
											.addComponent(label_5, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE))
										.addGroup(gl_contentPane.createSequentialGroup()
											.addComponent(lblLoguin, GroupLayout.PREFERRED_SIZE, 64, GroupLayout.PREFERRED_SIZE)
											.addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
											.addComponent(textFieldLoguin, GroupLayout.PREFERRED_SIZE, 239, GroupLayout.PREFERRED_SIZE))
										.addComponent(label_6, GroupLayout.PREFERRED_SIZE, 35, GroupLayout.PREFERRED_SIZE))
									.addGap(18)
									.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
										.addGroup(gl_contentPane.createSequentialGroup()
											.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
												.addComponent(textFieldCidade, GroupLayout.PREFERRED_SIZE, 139, GroupLayout.PREFERRED_SIZE)
												.addGroup(gl_contentPane.createSequentialGroup()
													.addComponent(textFieldFone, 139, 139, 139)
													.addPreferredGap(ComponentPlacement.RELATED)))
											.addGap(18)
											.addComponent(label_9, GroupLayout.PREFERRED_SIZE, 35, GroupLayout.PREFERRED_SIZE)
											.addPreferredGap(ComponentPlacement.RELATED)
											.addComponent(textFieldCep, 143, 143, 143))
										.addGroup(gl_contentPane.createSequentialGroup()
											.addComponent(lblSenha, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE)
											.addPreferredGap(ComponentPlacement.UNRELATED)
											.addComponent(textFieldSenha, GroupLayout.DEFAULT_SIZE, 284, Short.MAX_VALUE)))))
							.addGap(23))
						.addGroup(gl_contentPane.createSequentialGroup()
							.addGap(216)
							.addComponent(lblCadastroFuncionrio))
						.addGroup(gl_contentPane.createSequentialGroup()
							.addGap(276)
							.addComponent(button)
							.addGap(18)
							.addComponent(button_1, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)))
					.addContainerGap())
		);
		gl_contentPane.setVerticalGroup(
			gl_contentPane.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_contentPane.createSequentialGroup()
					.addContainerGap()
					.addComponent(lblCadastroFuncionrio)
					.addGap(28)
					.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
						.addComponent(label_1, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
						.addGroup(gl_contentPane.createSequentialGroup()
							.addGap(1)
							.addComponent(textFieldNome, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
					.addGap(10)
					.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
						.addComponent(label_2, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
						.addGroup(gl_contentPane.createSequentialGroup()
							.addGap(1)
							.addComponent(textFieldEnd, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
					.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_contentPane.createSequentialGroup()
							.addGap(10)
							.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
								.addComponent(label_3, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
								.addGroup(gl_contentPane.createSequentialGroup()
									.addGap(1)
									.addComponent(textFieldBairro, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
								.addComponent(label_10, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)))
						.addGroup(gl_contentPane.createSequentialGroup()
							.addGap(11)
							.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
								.addComponent(textFieldCidade, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
								.addComponent(label_9, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
								.addComponent(textFieldCep, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))))
					.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_contentPane.createSequentialGroup()
							.addGap(10)
							.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
								.addComponent(label_4, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
								.addGroup(gl_contentPane.createSequentialGroup()
									.addGap(1)
									.addComponent(textFieldEstado, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
							.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
								.addGroup(gl_contentPane.createSequentialGroup()
									.addGap(12)
									.addComponent(textFieldCpf, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
								.addGroup(gl_contentPane.createSequentialGroup()
									.addPreferredGap(ComponentPlacement.UNRELATED)
									.addComponent(label_6, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))))
						.addGroup(gl_contentPane.createSequentialGroup()
							.addGap(18)
							.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
								.addComponent(textFieldFone, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
								.addComponent(label_5, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))))
					.addPreferredGap(ComponentPlacement.UNRELATED)
					.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
							.addComponent(lblLoguin, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
							.addComponent(lblSenha, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
							.addComponent(textFieldLoguin, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
						.addComponent(textFieldSenha, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(51)
					.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
						.addComponent(button_1, GroupLayout.PREFERRED_SIZE, 41, GroupLayout.PREFERRED_SIZE)
						.addComponent(button, GroupLayout.DEFAULT_SIZE, 37, Short.MAX_VALUE))
					.addGap(49))
		);
		contentPane.setLayout(gl_contentPane);
	}
}
